home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / usr_-_Usr_Files / INCLUDE / IEEE854.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  74 lines

  1. /* Copyright (C) 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef _IEEE854_H
  20. #define _IEEE854_H
  21.  
  22. #include <endian.h>
  23.  
  24. union ieee854_double
  25.   {
  26.     long double d;
  27.     
  28.     /* This is the IEEE 854 double-extended-precision format.  */
  29.     struct
  30.       {
  31. #if    __BYTE_ORDER == __BIG_ENDIAN
  32.     unsigned int negative:1;
  33.     unsigned int exponent:15;
  34.     unsigned int empty:16;
  35.     unsigned int mantissa0:32;
  36.     unsigned int mantissa1:32;
  37. #endif
  38. #if    __BYTE_ORDER == __LITTLE_ENDIAN
  39.     unsigned int mantissa1:32;
  40.     unsigned int mantissa0:32;
  41.     unsigned int exponent:15;
  42.     unsigned int negative:1;
  43.     unsigned int empty:16;
  44. #endif
  45.       } ieee;
  46.     
  47.     /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
  48.     struct
  49.       {
  50. #if    __BYTE_ORDER == __BIG_ENDIAN
  51.     unsigned int negative:1;
  52.     unsigned int exponent:15;
  53.     unsigned int empty:16;
  54.     unsigned int one:1;
  55.     unsigned int quiet_nan:1;
  56.     unsigned int mantissa0:30;
  57.     unsigned int mantissa1:32;
  58. #endif
  59. #if    __BYTE_ORDER == __LITTLE_ENDIAN
  60.     unsigned int mantissa1:32;
  61.     unsigned int mantissa0:30;
  62.     unsigned int quiet_nan:1;
  63.     unsigned int one:1;
  64.     unsigned int exponent:15;
  65.     unsigned int negative:1;
  66.     unsigned int empty:16;
  67. #endif
  68.       } ieee_nan;
  69.   };
  70.  
  71. #define _IEEE854_DOUBLE_BIAS 0x3fff
  72.  
  73. #endif    /* _IEEE854_H */
  74.